<?php
namespace Tbf\Bundle\PackageBundle\Route;
use Symfony\Component\Config\Loader\Loader;
use Tbf\Bundle\PackageBundle\PackageManager;

class PackageRouteLoader extends Loader
{
    protected $pm;
    public function __construct(PackageManager $pm)
    {
        $this->pm = $pm;
    }
    /**
     * Loads a resource.
     *
     * @param mixed  $resource The resource
     * @param string $type     The resource type
     */
    public function load($resource, $type = null)
    {
        $ret = $this->pm->getRouteCollection();

        return $ret;
    }

    /**
     * Returns true if this class supports the given resource.
     *
     * @param mixed  $resource A resource
     * @param string $type     The resource type
     *
     * @return Boolean true if this class supports the given resource, false otherwise
     */
    public function supports($resource, $type = null)
    {
        if ($type==='tbf_package') {
            return true;
        }

        return false;
    }
}
